From ed8d0fc69161066c0266b5bc8a5d58ae99a14745 Mon Sep 17 00:00:00 2001 From: Richard Hult Date: Wed, 6 Jun 2007 16:23:50 +0000 Subject: [PATCH] Don't do anything if the two windows are the same. 2007-06-06 Richard Hult * gdk/quartz/gdkevents-quartz.c (get_converted_window_coordinates): Don't do anything if the two windows are the same. (find_window_for_ns_event): Translate coordinates to be relative the grab window when appropriate. svn path=/trunk/; revision=18064 --- ChangeLog | 7 +++++++ gdk/quartz/gdkevents-quartz.c | 26 ++++++++++++++++++-------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96aa053ef1..9b0a0f0ce2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-06-06 Richard Hult + + * gdk/quartz/gdkevents-quartz.c (get_converted_window_coordinates): + Don't do anything if the two windows are the same. + (find_window_for_ns_event): Translate coordinates to be relative + the grab window when appropriate. + 2007-06-06 Emmanuele Bassi * gtk/gtkfilechooserdefault.c: diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c index ae58307b79..8d0e9439ee 100644 --- a/gdk/quartz/gdkevents-quartz.c +++ b/gdk/quartz/gdkevents-quartz.c @@ -905,6 +905,13 @@ get_converted_window_coordinates (GdkWindow *in_window, int in_origin_x, in_origin_y; int out_origin_x, out_origin_y; + if (in_window == out_window) + { + *out_x = in_x; + *out_y = in_y; + return; + } + /* First translate to "in" toplevel coordinates, then on to "out" * toplevel coordinates, and finally to "out" child (the passed in * window) coordinates. @@ -1077,26 +1084,29 @@ find_window_for_ns_event (NSEvent *nsevent, return real_window; } - /* FIXME: This part needs some fixing, it doesn't return - * the right coordinates if the nsevent happens for a - * different window than the grab window. - */ + /* Finally check the grab window. */ if (pointer_grab_event_mask & get_event_mask_from_ns_event (nsevent)) { + GdkWindow *event_toplevel; GdkWindow *grab_toplevel; NSPoint point; int x_tmp, y_tmp; + event_toplevel = [(GdkQuartzView *)[[nsevent window] contentView] gdkWindow]; grab_toplevel = gdk_window_get_toplevel (_gdk_quartz_pointer_grab_window); point = [nsevent locationInWindow]; x_tmp = point.x; y_tmp = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (grab_toplevel)->impl)->height - point.y; - get_child_coordinates_from_ancestor (grab_toplevel, - x_tmp, y_tmp, - _gdk_quartz_pointer_grab_window, - x, y); + /* Translate the coordinates so they are relative to + * the grab window instead of the event toplevel for + * the cases where they are not the same. + */ + get_converted_window_coordinates (event_toplevel, + x_tmp, y_tmp, + _gdk_quartz_pointer_grab_window, + x, y); return _gdk_quartz_pointer_grab_window; } -- 2.30.2